(function (window, $) {
    $(function () {
        // 设置iframe的高度，非精准适应屏幕高度
        var docHeight = $(document).height();
        $('#reportContainer, #applicationContainer').height(docHeight - 300);
        var vm = avalon.define({
            $id: 'userModify',
            inquiryModel:{
                certifiedHeadUrl:'resources/skins/img/img2.jpg',
                idcardFrontUrl:'resources/skins/img/img3.jpg',
                idcardBackUrl:'resources/skins/img/img4.jpg',
                certifiedHeadUrlId:'',
                idcardFrontUrlId:'',
                idcardBackUrlId:'',
            },
            scan: function (deviceType) {
                var img = Camera.scan(deviceType);
                vm.inquiryModel.certifiedHeadUrl=img;
                $("#certifiedHeadUrl").attr("src",img);
            },
            readIdCard:function(){
                var data=Camera.readIdCardData();
                vm.inquiryModel.idcardFrontUrl=data.front;
                vm.inquiryModel.idcardBackUrl=data.back;
                $("#idcardFrontUrl").attr("src",data.front);
                $("#idcardBackUrl").attr("src",data.back);
            }
        });
        avalon.scan($("#page-content-wrapper")[0]);
        window.setTimeout(function () {
            Camera.destroy();
            Camera.init({
                container: '#face',
                id: 'ca',
                width:280,
                height:200,
                viewWidth:240,
                viewHeight:180,
                type: 2,
                facRect:false
            });
        }, 1000);
    });

}(window, jQuery));